package gang.com.mobelhelper.di.module;

import android.app.Application;

import com.google.gson.Gson;

import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;

/**
 * Created by xiaogangzai on 2017/7/16.
 * App级别的Module1
 */
@Module
public class AppModule {
    //注意Application是Android系统级别的内容，不可以通过new出来，对于这种智能通过构造方法传递进来
    private Application mApplicaton;

    public AppModule(Application application) {
        this.mApplicaton = application;
    }

    //这个东西都是单例的，我们要加上Singleton
    @Provides
    @Singleton
    public Application provideApplication() {
        return mApplicaton;
    }

    @Provides
    @Singleton
    public Gson provideGson() {
        return new Gson();
    }
}
